import pygame
from pygame.locals import *

#初始化
pygame.init()

#窗口大小
size = width, height = 480, 480
#初始化一个准备显示的窗口
screen = pygame.display.set_mode(size)
#创建一个对象来帮助跟踪时间
clock = pygame.time.Clock()
#颜色
black, red, blue, white = (0, 0, 0), (255, 0, 0), (0, 0, 255), (255, 255, 255)
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            exit(0)
    #pygame.draw  绘制图形模块rect()绘制矩形line()绘制线段。具体看Pygame文档。
    pygame.draw.rect(screen, white, (0, 0, width, height))
    pygame.draw.line(screen, black, (160, 0), (160, 480), 5)
    pygame.draw.line(screen, black, (320, 0), (320, 480), 5)
    pygame.draw.line(screen, black, (0, 160), (480, 160), 5)
    pygame.draw.line(screen, black, (0, 320), (480, 320), 5)
    
    #游戏最大帧率60
    clock.tick(60)
    #刷新
    pygame.display.flip()
